Format UTC to local timezone using PYTZ for Django

40

import pytz
book_obj = Book.objects.get(pk=1)  # Replace query parameters according to your needs
my_timezone = pytz.timezone("Asia/Kolkata") # Replace Asia/Kolkata with your timezone
local_created_at = book_obj.created_at.astimezone(my_timezone)

Comments

Submit
0 Comments